/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ListaEstadisticas.java
 *
 * Created on 24/08/2011, 03:51:36 PM
 */

package proyectocatalina;

import proyectocatalina.estadisticas.*;
import javax.swing.JInternalFrame;
import proyectocatalina.estadisticas.formulariosemestre;

/**
 *
 * @author principal
 */
public class ListaEstadisticas extends javax.swing.JInternalFrame {

    /** Creates new form ListaEstadisticas */
    public ListaEstadisticas() {
        initComponents();
        this.setClosable(true);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jlista = new javax.swing.JList();
        jButton1 = new javax.swing.JButton();

        setClosable(true);
        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setIconifiable(true);
        setMaximizable(true);
        setResizable(true);

        jlista.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Cantidad de Alumnos por Carrera", "Cantidad de Alumnos por Sexo", "Cantidad de Alumnos segun Edad", "Cantidad de Alumnos segun Semestre", "Cantidad de Alumnos segun Periodo", "Cantidad de Alumnos segun Condición" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jlista.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jlista.setName(""); // NOI18N
        jScrollPane1.setViewportView(jlista);

        jButton1.setText("Ver");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 332, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE)
                    .addComponent(jButton1))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
            FormularioCarrera Carrera = new FormularioCarrera();         
            FormularioEdad Edad = new FormularioEdad();
            FormularioSexo sexo = new FormularioSexo();
            formulariosemestre semestre = new formulariosemestre();
            formulariocondicion condicion = new formulariocondicion();
            Formularioperiodo periodo = new Formularioperiodo();
            JInternalFrame[] formularios = {Carrera,sexo,Edad,semestre,periodo,condicion};
            int elementoseleccionado = jlista.getSelectedIndex();
            int x = Principal.panel.getSize().width -  formularios[elementoseleccionado].getSize().width;
            int y = Principal.panel.getSize().height -  formularios[elementoseleccionado].getSize().height;
            formularios[elementoseleccionado].setLocation(x/2,y/2);

            Principal.panel.add(formularios[elementoseleccionado]);
            formularios[elementoseleccionado].show();      
       
    }//GEN-LAST:event_jButton1ActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new ListaEstadisticas().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JList jlista;
    // End of variables declaration//GEN-END:variables

}
